use chrono::NaiveDateTime;
use sqlx::mysql::MySqlPoolOptions;
use sqlx::{MySql, Pool};


#[allow(unused)]
#[derive(sqlx::FromRow, Debug)]
pub struct SysConfig {
    pub variable: String,
    pub value: Option<String>,
    pub set_time: NaiveDateTime,
    pub set_by: Option<String>,
}

pub async fn get_pool() -> Result<Pool<MySql>, sqlx::Error> {
    let pool = MySqlPoolOptions::new()
        .max_connections(5)
        .connect("mysql://root:root@localhost/sea-orm").await?;
    Ok(pool)
}